package org.come.Jpanel;

import java.awt.CardLayout;
import java.awt.Dimension;

import javax.swing.JPanel;

import org.come.bean.LaborRank;

/**
 * @author HGC<br>
 * @time 2020年4月28日 上午10:02:47<br>
 * @class 类名:TrueFeedbackCardJPanel 五一真情回馈卡牌布局面板<br>
 */
public class TrueFeedbackCardJPanel extends JPanel {
    private CardLayout cardLayout;
    
    //抽奖面板
    private TrueFeedbackLotteyJPanel trueFeedbackLotteyJPanel;
    private TrueFeedbackScPanel trueFeedbackScPanel;
    //0累计充值面板 1限时神宠面板 2抽奖面板
    private int typeMenu;
    
    public TrueFeedbackCardJPanel() {
        setPreferredSize(new Dimension(430,440));
        setOpaque(false);
        cardLayout= new CardLayout();
        setLayout(cardLayout);
        trueFeedbackLotteyJPanel = new TrueFeedbackLotteyJPanel();
        trueFeedbackScPanel = new TrueFeedbackScPanel();
        this.add(trueFeedbackScPanel, "sc");
        this.add(trueFeedbackLotteyJPanel, "lottey");
    }
    
    
    /**切换面板*/
    public void changeShowView(int caozuo){
        if(caozuo == 0||caozuo == 1){
            if(typeMenu == 2){
                cardLayout.show(this, "sc");
            }
            trueFeedbackScPanel.changeViewImg(caozuo);
        }else if(caozuo == 2){
            cardLayout.show(this, "lottey");
        }
        typeMenu = caozuo;
    }
    /**展示数据*/
    public void showViewData(LaborRank laborRank){
        int type = laborRank.getType();
        if(type<=1){
            trueFeedbackScPanel.showScpane(laborRank);
        }else{
            trueFeedbackLotteyJPanel.showViewData(laborRank);
        }
        
        changeShowView(laborRank.getType());
    }

    public CardLayout getCardLayout() {
        return cardLayout;
    }

    public void setCardLayout(CardLayout cardLayout) {
        this.cardLayout = cardLayout;
    }

    public TrueFeedbackLotteyJPanel getTrueFeedbackLotteyJPanel() {
        return trueFeedbackLotteyJPanel;
    }

    public void setTrueFeedbackLotteyJPanel(TrueFeedbackLotteyJPanel trueFeedbackLotteyJPanel) {
        this.trueFeedbackLotteyJPanel = trueFeedbackLotteyJPanel;
    }

    public TrueFeedbackScPanel getTrueFeedbackScPanel() {
        return trueFeedbackScPanel;
    }

    public void setTrueFeedbackScPanel(TrueFeedbackScPanel trueFeedbackScPanel) {
        this.trueFeedbackScPanel = trueFeedbackScPanel;
    }

    public int getTypeMenu() {
        return typeMenu;
    }

    public void setTypeMenu(int typeMenu) {
        this.typeMenu = typeMenu;
    }

}
